home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pcscheme / geneva / sources.exe / SOURCES / BGI / C0.ASM next >
Encoding:
Assembly Source File  |  1993-03-21  |  1.6 KB  |  118 lines

  1. IDEAL
  2. %TITLE    "C0: Startup Code for a BGI Driver"
  3. MODEL    TINY
  4. CODESEG
  5.  
  6. GLOBAL C    dispatch:WORD
  7. GLOBAL C    fardispatch:WORD
  8. GLOBAL C    emulate:NEAR
  9. GLOBAL C    bitmaputl:NEAR
  10.  
  11. ORG    0
  12. PROC    main    FAR
  13.     push    ds
  14.     push    cs
  15.     pop    ds
  16.     cld
  17.     push    bp
  18.     push    es
  19.     push    bx            ; at bp+6
  20.     push    dx            ; at bp+4
  21.     push    cx            ; at bp+2
  22.     push    ax            ; at bp
  23.     mov    bp, sp
  24.     jmp    main_2
  25. ENDP    main
  26.  
  27. ORG    10h
  28. PROC    emulate C
  29.     ret
  30.     dd    ?
  31. ENDP    emulate
  32.  
  33. PROC    main_2    FAR
  34.     lea    ax, [bp+6]
  35.     push    ax
  36.     sub    ax, 2
  37.     push    ax
  38.     sub    ax, 2
  39.     push    ax
  40.     add    ax, 4
  41.     push    ax
  42.     sub    ax, 6
  43.     push    ax
  44. ;    INT    3            ; debug
  45.     call    [dispatch+si]
  46.     add    sp, 10
  47.     sub    ax, 1            ; if RV=0, no carry
  48.     cmc                ; else carry set
  49.     pop    ax
  50.     pop    cx
  51.     pop    dx
  52.     pop    bx
  53.     pop    es
  54.     pop    bp
  55.     pop    ds
  56.     ret
  57. ENDP    main_2
  58.  
  59. PROC C    bitmaputl, _ax:WORD, _bx:WORD, _cx:WORD, _dx:WORD, @@procs:WORD
  60.     mov    bx, [@@procs]
  61.     push    cs
  62.     pop    [WORD HIGH (DWORD ss:bx)]
  63.     mov    [WORD LOW (DWORD ss:bx)], OFFSET @@dispatch
  64.     ret
  65. LABEL    @@dispatch    WORD
  66.     dw    $$exit
  67.     dw    $$exit
  68.     dw    $$putpixel
  69.     dw    $$getpixel
  70.     dw    $$getpixelwidth
  71.     dw    $$exit
  72.     dw    $$exit
  73.     dw    $$setwritemode
  74.  
  75. PROC    $$exit    FAR
  76.     ret
  77. ENDP    $$exit
  78.  
  79. PROC    $$putpixel    FAR
  80.     push    ds
  81.     push    cs
  82.     pop    ds
  83.     call    [fardispatch+0] C, ax, bx, dx
  84.     pop    ds
  85.     ret
  86. ENDP    $$putpixel
  87.  
  88. PROC    $$getpixel    FAR
  89.     push    ds
  90.     push    cs
  91.     pop    ds
  92.     call    [fardispatch+2] C, ax, bx
  93.     mov    dx, ax
  94.     pop    ds
  95.     ret
  96. ENDP    $$getpixel
  97.  
  98. PROC    $$getpixelwidth    FAR
  99.     push    ds
  100.     push    cs
  101.     pop    ds
  102.     call    [fardispatch+4] C
  103.     pop    ds
  104.     ret
  105. ENDP    $$getpixelwidth
  106.  
  107. PROC    $$setwritemode    FAR
  108.     push    ds
  109.     push    cs
  110.     pop    ds
  111.     call    [fardispatch+6] C, ax
  112.     pop    ds
  113.     ret
  114. ENDP    $$setwritemode
  115. ENDP    bitmaputl
  116. END
  117.  
  118.